Use database instead of RDS
##
## Attaching package: 'dbplyr'
## The following objects are masked from 'package:dplyr':
##
## ident, sql
Dump the data to a SQLite. SQLite is a lightweight, self-contained, and serverless relational database management system (RDBMS). It’s designed for simplicity and efficiency.
# Connect to SQLite database
db <- DBI::dbConnect(RSQLite::SQLite(), "db/imdb.db") #try :memory: instead of a file
# Write the data frame to the SQLite database using dbplyr
DBI::dbWriteTable(db, "title_basics", data_imdb, overwrite = TRUE)
DBI::dbWriteTable(db, "title_basics_no_index", data_imdb, overwrite = TRUE)
# Create an index on startYear
DBI::dbExecute(db, "CREATE INDEX idx_startYear ON title_basics(startYear);")
## [1] 0
# Close the database connection
DBI::dbDisconnect(db)